package com.gxy.learn.design.model.behaviour.mediator;

/**
 * @description: 具体抽象者角色
 * @author: gaoxueyong
 * @Date: 2022/11/8 21:03
 */
public class MediatorStructure extends Mediator {

    private HouseOwner houseOwner;
    private Tenant tenant;

    public HouseOwner getHouseOwner() {
        return houseOwner;
    }

    public void setHouseOwner(HouseOwner houseOwner) {
        this.houseOwner = houseOwner;
    }

    public Tenant getTenant() {
        return tenant;
    }

    public void setTenant(Tenant tenant) {
        this.tenant = tenant;
    }

    @Override
    public void constact(String message, Person person) {
        if (person == houseOwner) {
//            房东
            tenant.getMessage(message);
        } else if (person == tenant) {
            houseOwner.getMessage(message);
        }
    }
}
